/******************************************************************************
 * Copyright (C) 2015  671643387@qq.com
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 *****************************************************************************/

#ifndef UGAME_DATA_REL_QUERYRESULT_H_
#define UGAME_DATA_REL_QUERYRESULT_H_

#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif

#include <cstdint>
#include <UGame/Macros.h>

namespace UGame {
namespace Data {
namespace Rel {
    class Field;

    class QueryResult
    {
    public:
        QueryResult(void);
        virtual ~QueryResult(void);

    public:
        virtual bool NextRow(void) = 0;
        virtual void Close(void) = 0;

        Field& operator[](unsigned int _Index);
        Field& GetField(unsigned int _Index);
        unsigned int GetFieldCount(void) const { return _nField; }
        Field* Fetch(void) const { return _row; }
        std::uint64_t GetRowCount(void) const { return _rowCount; }

    protected:
        Field* _row;
        unsigned int _nField;
        std::uint64_t _rowCount;
        DISALLOW_COPY_AND_ASSIGN(QueryResult);
    };

}}}

#endif // UGAME_DATA_REL_QUERYRESULT_H_
